import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import Components from 'unplugin-vue-components/vite';

export default defineConfig({
  plugins: [
    uni(),
    Components({
      resolvers: [
      ],
      dts: true,
    }),
  ],
  css: {
    devSourcemap: true,
  },
  resolve: {
    alias: {
      '@': '/src',
      '@vant/weapp': '/node_modules/@vant/weapp/dist' // 添加 alias，确保路径正确
    }
  },
  build: {
    rollupOptions: {
      external: ['@vant/weapp'] // 防止 Vite 尝试解析 @vant/weapp 的 JavaScript 模块
    }
  }
});
